package org.concordia.wsdl.evaluator;

import java.util.List;

import org.concordia.wsdl.helper.ListUtils;
import org.concordia.wsdl.model.WebService;

/**
 * 
 * @author ericzhao
 *
 */
public class BFStarEvaluator implements Evaluator{

	public float evaluate(WebService candidate, List<String> rOut,
			List<String> knownParams, List<WebService> invokedWSList, 
			List<WebService> remainingWSList, List<WebService> candidates) {

		float sum;
		float gScore = invokedWSList.size();
		float hScore;
		List<String> remainingParams = ListUtils.sub(rOut, knownParams);
		List<String> joinList = ListUtils.join(remainingParams, candidate.getOutputs());
		if(joinList.size() == 0){
			hScore = 2;
		}else{
			hScore = 1 / joinList.size();		
		}
		sum = hScore + gScore;
		candidate.setScore(sum);
		return sum;
	}
	

	

}
